<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:s="http://sduept.security.el/func"
	template="/template/template.xhtml">
	<ui:define name="head">
	<link rel="stylesheet" href="/resources/bootstrap/css/bootstrap-datetimepicker.min.css" />
		<style>
#WrapProtectTimeLine {
	height: 50px;
	padding-top: 10px;
}
</style>

	</ui:define>
	<ui:define name="content">
		<div class="nav-tabs-custom full-center-content-scroll-noheader">
			<div class="tab-content no-padding">
				<div class="chart tab-pane active" id="protectPanel"
					style="position: relative">
					<h:form>
						<p:remoteCommand name="changeYear" actionListener="#{responseFeaProtectController.changeYear}" />
					</h:form>
					<div id="WrapProtectTimeLine" class="col-sm-12 col-lg-12">
						<p:outputLabel value="选择年份 ：" />
						<input type="text" id="startYear" style="width:80px;height:30px;text-align:center;margin-right:5px;" />
						<p:outputLabel value="至" style="margin-right:5px;" />
						<input type="text" id="endYear" style="width:80px;height:30px;text-align:center;margin-right:10px;" />
						<p:commandButton value="查询" icon="ui-icon-search" oncomplete="onYearChanged()" style="margin-right:5px;" />
						<p:commandButton value="数据维护" icon="ui-icon-document"
							rendered="#{s:hasPermission(session,'tjfx_bhxysjfx_sjwh')}"
							actionListener="#{responseFeaProtectController.initProtectResponseTimeStatistics}"
							update="form" oncomplete="PF('dataDlg').show()" />
					</div>
					<div class="col-sm-12 col-lg-12">
						<div class="box box-primary">
							<div id="protectChart5" style="height: 250px;text-align:center;color:grey;font-size:16px;font-weight:bold" ></div>
						</div>
					</div>
					<div class="nav-tabs-custom">
						<div class="tab-content no-padding">
							<div id="protectAreaPanel" class="chart tab-pane active"
								style="position: relative">
								<div class="col-sm-12 col-lg-12">
									<div class="box box-primary">
										<div id="protectChart3" style="height: 250px;text-align:center;color:grey;font-size:16px;font-weight:bold"></div>
									</div>
								</div>
								<div class="col-sm-12 col-lg-12">
									<div class="box box-primary">
										<div id="protectChart4" style="height: 250px;text-align:center;color:grey;font-size:16px;font-weight:bold"></div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<p:dialog widgetVar="dataDlg" id="dataDlg" header="数据维护" width="1100"
			height="650" onHide="location.reload();">
			<h:form id="form">
				<div class="box box-solid with-border">
					<div class="box-header">
						<p:outputLabel value="年份：" />
						<h:selectOneMenu value="#{responseFeaProtectController.year}"
							style="width:130px;margin-right:20px;height:30px" id="rfpYear">
							<f:selectItems value="#{responseFeaProtectController.years}" />
						</h:selectOneMenu>
						<p:outputLabel value="单位：" />
						<h:selectOneMenu value="#{responseFeaProtectController.area}"
							style="width:130px;margin-right:20px;height:30px" id="company">
							<f:selectItem itemValue="all" itemLabel="全部" />
							<f:selectItems value="#{responseFeaProtectController.areas}" />
						</h:selectOneMenu>
						<p:commandButton value="查询" icon="ui-icon-search"
							style="margin-right:10px"
							actionListener="#{responseFeaProtectController.search}"
							update="form:dataTable" />
						<p:commandButton value="重置" icon="ui-icon-refresh"
							style="margin-right:10px"
							actionListener="#{responseFeaProtectController.reset()}"
							update="dataTable rfpYear company" />
					</div>
				</div>
				<p:toolbar id="toolbar">
					<f:facet name="left">
						<p:commandButton value="新建" icon="fa fa-plus"
							actionListener="#{responseFeaProtectController.preCreatProtectResponseTimeStatistics}"
							oncomplete="PF('createDlg').show()" update="createForm" />
						<p:commandButton value="编辑" icon="fa fa-pencil" id="edit"
							actionListener="#{responseFeaProtectController.editProtectResponseTimeStatistics}"
							oncomplete="PF('createDlg').show()" update="createForm"
							disabled="#{responseFeaProtectController.selected.id == null}" />
						<p:commandButton value="删除" icon="fa fa-trash" id="delete"
							actionListener="#{responseFeaProtectController.deleteProtectResponseTimeStatistics}"
							update="form:dataTable form:edit form:delete form:msgs form:company form:rfpYear"
							disabled="#{responseFeaProtectController.selected.id == null}">
							<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
						</p:commandButton>
						<p:growl id="msgs" showDetail="true" />
						<p:commandButton value="下载模板" icon="ui-icon-arrowthick-1-s"
							ajax="false"
							actionListener="#{responseFeaProtectController.fileDownloadView}">
							<p:fileDownload
								value="#{responseFeaProtectController.templateFile}" />
						</p:commandButton>
						<p:commandButton id="newStatBtn" value="上传文件" icon="ui-icon-arrowthick-1-n"
							actionListener="#{responseFeaProtectController.chooseEquipment}">
							<p:ajax event="dialogReturn"
								update="form:msgs form:dataTable form:rfpYear"
								listener="#{responseFeaProtectController.onSelectorChosen}" />
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
					<p:commandButton value="是" type="button"
						styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
					<p:commandButton value="否" type="button"
						styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</p:confirmDialog>
				<p:dataTable id="dataTable"
					value="#{responseFeaProtectController.protectResponseTimeStatisticsList}"
					var="prts" rowKey="#{prts.id}" emptyMessage="无记录" rowIndexVar="ite"
					paginator="true" rows="20"
					selection="#{responseFeaProtectController.selected}"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="20,50,100" paginatorPosition="bottom"
					style="text-align:center;margin-top:3px">
					<f:facet name="{Customization}">
						<p:outputLabel value="总计：#{responseFeaProtectController.protectResponseTimeStatisticsList.size()} 条记录" style="margin-right:20px;" />
					</f:facet>
					<p:ajax event="rowSelectRadio" listener="#{responseFeaProtectController.onRowSelect}" update="form:edit form:delete" />
					<p:column selectionMode="single" width="60" style="text-align:center" />
					<p:column width="60" headerText="序号">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="单位" width="20%" sortBy="#{prts.area}">
						<p:outputLabel value="#{prts.area}" />
					</p:column>
					<p:column headerText="年" width="10%" sortBy="#{prts.year}">
						<p:outputLabel value="#{prts.year}" />
					</p:column>
					<p:column headerText="月" width="10%" sortBy="#{prts.month}">
						<p:outputLabel value="#{prts.month}" />
					</p:column>
					<p:column headerText="保护平均动作时间" width="20%"
						sortBy="#{prts.avgActTime}">
						<p:outputLabel value="#{prts.avgActTime}" />
					</p:column>
					<p:column headerText="保护最长动作时间" width="20%"
						sortBy="#{prts.maxActTime}">
						<p:outputLabel value="#{prts.maxActTime}" />
					</p:column>
				</p:dataTable>
			</h:form>
		</p:dialog>
		<p:dialog widgetVar="createDlg" header="数据维护" width="500" height="500">
			<h:form id="createForm">
				<p:toolbar id="createToolBar">
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk"
							actionListener="#{responseFeaProtectController.saveProtectResponseTimeStatistics}"
							update=":form:dataTable :form:edit :form:delete :form:msgs :form:company :form:rfpYear"
							oncomplete="PF('createDlg').hide()" />
					</f:facet>
				</p:toolbar>
				<p:outputPanel style="text-align:center;">
					<p:panelGrid columns="2">
						<h:outputText value="单位" />
						<p:autoComplete dropdown="true"
							value="#{responseFeaProtectController.protectResponseTimeStatistics.area}"
							completeMethod="#{responseFeaProtectController.completeArea}" />
						<h:outputText value="年" />
						<p:inputText label="content" style="width:100%"
							value="#{responseFeaProtectController.protectResponseTimeStatistics.year}">
						</p:inputText>
						<h:outputText value="月" />
						<p:inputText label="content" style="width:100%"
							value="#{responseFeaProtectController.protectResponseTimeStatistics.month}">
						</p:inputText>
						<h:outputText value="保护最长动作时间" />
						<p:inputText label="content" style="width:100%"
							value="#{responseFeaProtectController.protectResponseTimeStatistics.maxActTime}">
						</p:inputText>
						<h:outputText value="保护平均动作时间" />
						<p:inputText label="content" style="width:100%"
							value="#{responseFeaProtectController.protectResponseTimeStatistics.avgActTime}">
						</p:inputText>
					</p:panelGrid>
				</p:outputPanel>
			</h:form>
		</p:dialog>
	</ui:define>
	<ui:define name="contentend">
		<script src="#{request.contextPath}/resources/plugins/echarts/echarts.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/timeLineChart.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/timeBarChart.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/timePieChart.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/categoryBarChart.js" />
		<script src="#{request.contextPath}/resources/js/array-util.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/category2YLineChart.js" />
		<script src="#{request.contextPath}/resources/js/math/GaussianDistribution.js" />
		<script src="#{request.contextPath}/resources/bootstrap/js/bootstrap-datetimepicker.min.js" />
		<script src="protectResponseFeaProtect.js" />
	</ui:define>
</ui:composition>